package pl.edu.agh.student.nn.core;

/**
 * 
 * Sigmoidalna funkcja aktywacji f(x)=1+e^(-bx)
 * 
 */
public class SigmoidalFunction extends ActivationFunction {

    private double beta;

    public SigmoidalFunction() {
        super(ActivationFunctionType.S);
    }

    public SigmoidalFunction(double beta) {
        super(ActivationFunctionType.S);
        this.beta = beta;
    }

    public double getResult(double input) {
        return 1 / (1 + Math.exp(-1 * beta * input));
    }
    
    public double d(double input){
        return beta * getResult(input) * (1 - getResult(input));
    }

    @Override
    public String display() {
        return type + "|" + beta;
    }

    @Override
    public String toString() {
        return "SigmoidalFunction{" + "beta=" + beta + '}';
    }

}
